package cn.com.cetccst.appstore.database;

public class AppStoreMigration {

    //TODO 升级数据库Migration写这里，下面是一个示例
//    public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
//        @Override
//        public void migrate(SupportSQLiteDatabase database) {
//            database.beginTransaction();
//            try {
//                database.execSQL("CREATE TABLE IF NOT EXISTS `app_model_V2` (`user_id` TEXT NOT NULL, `enterprise_id` TEXT NOT NULL, `my_app` INTEGER NOT NULL, `badge_number` INTEGER NOT NULL, `trash` INTEGER NOT NULL, `authed_time` INTEGER NOT NULL, `id` TEXT NOT NULL, `name` TEXT, `publisher` TEXT, `kind` TEXT DEFAULT 'SELF_CONSTRUCT', `type` TEXT NOT NULL, `frequent` INTEGER NOT NULL, `icon` TEXT, `tags` TEXT, `app_key` TEXT, `package_name` TEXT, `version_code` INTEGER NOT NULL, `version_name` TEXT, `file` TEXT, `file_size` INTEGER, `home_page` TEXT, `category_id` TEXT, `category_name` TEXT, `location` TEXT NOT NULL DEFAULT 'INTERNAL', `app_signature` TEXT, `ent_enabled` INTEGER NOT NULL DEFAULT 0, `is_hide` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`, `user_id`, `enterprise_id`, `type`, `location`));");
//                database.execSQL("INSERT INTO app_model_V2(user_id, enterprise_id, my_app, badge_number, trash, authed_time, id, name, publisher, type, frequent, icon, app_key, package_name, version_code, version_name, file, file_size, home_page, category_id, category_name) SELECT user_id, enterprise_id, myapp, badge_number, trash, authedTime, id, name, publisher, type, frequent, icon, app_key, package_name, version_code, version_name, file, file_size, home_page, category_id, category_name  FROM app_model;");
//                database.execSQL("DROP TABLE app_model;");
//                //设置事务标志为成功，当结束事务时就会提交事务
//                database.setTransactionSuccessful();
//            } catch (Exception e) {
//                throw (e);
//            } finally {
//                //结束事务
//                database.endTransaction();
//            }
//        }
//    };


}
